package com.design.pattern.Singleton;

/**
 * Created by Administrator on 2016/5/16.
 */
public class SingletonPattern {
    private static SingletonPattern ourInstance = new SingletonPattern();

    public static SingletonPattern getInstance() {
        return ourInstance;
    }

    private SingletonPattern() {
    }

    /**
     * 线程安全的单例模式
     */
    private static class InstanceHolder{
        public static SingletonPattern instance = new SingletonPattern();
    }

    public static SingletonPattern getOurInstance2(){
        return InstanceHolder.instance;
    }
}
